{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import plotly.express as px\n",
    "import mytools\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [],
   "source": [
    "df1 = pd.read_excel(R\"data\\开屏广告态度.xlsx\")\n",
    "# 使用自定义工具包中的函数读取spss格式文件\n",
    "df1,metadata = mytools.read_spss(R\"data\\大学生对于开屏广告的态度.sav\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 明确数据分析目标\n",
    "\n",
    "该研究的目的详细描述大学生群体对手机APP开屏广告的态度。属于描述性研究。\n",
    "\n",
    "> 描述性研究对社会现象的状况、过程和特征进行客观准确的描述。进而揭示某种现象是什么，是如何发展的，特点和性质是什么。描述性研究的基本要求是对社会现象的描述应当达到描述的准确性和概括性的要求。描述性研究的描述的是某个情境、社会环境或事物关系的特定细节。\n",
    "\n",
    ">描述性研究很重要，在没有很强的假定的条件下，能做的只能是描述性研究。\n",
    "\n",
    "该问卷属于非量表类问卷，并没有相关学术理论依据作为参考。\n",
    "\n",
    "非量表性问卷的设计，通常包括：\n",
    "\n",
    "1. 筛选题目。如您是否为在校大学生等等\n",
    "2. 样本背景信息题目。如性别、年龄、婚姻状况、学历、专业、月生活费等等\n",
    "3. 样本特征信息题目。如手机使用时长、网购年限、是否有收支计划等等。\n",
    "4. 样本基本现状题目。如网购的频率、是否购买过某种产品。\n",
    "5. 样本基本态度题目。如网购的原因等等。\n",
    "6. 其他题目\n",
    "\n",
    "非量表性问卷的分析思路是先对样本背景信息进行统计，然后描述样本基本情况和基本态度，还可以作一些差异性分析。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据获取\n",
    "\n",
    "本研究采用问卷调查法，采用方便抽样方法，通过问卷星网站发放问卷，共获得样本XXX个。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据清理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>序号</th>\n",
       "      <th>提交答卷时间</th>\n",
       "      <th>所用时间</th>\n",
       "      <th>来源</th>\n",
       "      <th>来源详情</th>\n",
       "      <th>来自IP</th>\n",
       "      <th>@1、您的性别</th>\n",
       "      <th>@2、您每天使用手机的频率</th>\n",
       "      <th>@3、您最常遇到开屏广告的APP类型是？</th>\n",
       "      <th>@4、您一天内在手机APP上看到开屏广告的次数是</th>\n",
       "      <th>...</th>\n",
       "      <th>@10、您对手机APP开屏广告的内容印象程度是</th>\n",
       "      <th>@11、哪一类的开屏广告会吸引您的注意？【多选</th>\n",
       "      <th>@12、您是否通过APP开屏广告主动接触其介绍的产</th>\n",
       "      <th>@13、您认为APP开屏广告存在哪些问题？</th>\n",
       "      <th>@14、开屏广告是否影响了您的正常浏览体验</th>\n",
       "      <th>@15、您认为每个APP开屏广告每天出现的次数最好</th>\n",
       "      <th>@16、您觉得开屏广告的时间最好控制在</th>\n",
       "      <th>@17、您认为APP开屏广告是否侵犯了您的隐私（如</th>\n",
       "      <th>@18、您认为开屏广告中的关闭键设置是否合理</th>\n",
       "      <th>@19、关于开屏广告的关闭键设置，您认为以下哪</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>0 rows × 25 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [序号, 提交答卷时间, 所用时间, 来源, 来源详情, 来自IP, @1、您的性别, @2、您每天使用手机的频率, @3、您最常遇到开屏广告的APP类型是？, @4、您一天内在手机APP上看到开屏广告的次数是, @5、您对哪类APP中的开屏广告更感兴趣？, @6、遇到APP开屏广告时，您的习惯一般是, @7、您对APP开屏广告的态度是, @8、您觉得多长时间的开屏广告能接受？, @9、您对APP开屏广告所表达的产品品牌活动信息, @10、您对手机APP开屏广告的内容印象程度是, @11、哪一类的开屏广告会吸引您的注意？【多选, @12、您是否通过APP开屏广告主动接触其介绍的产, @13、您认为APP开屏广告存在哪些问题？, @14、开屏广告是否影响了您的正常浏览体验, @15、您认为每个APP开屏广告每天出现的次数最好, @16、您觉得开屏广告的时间最好控制在, @17、您认为APP开屏广告是否侵犯了您的隐私（如, @18、您认为开屏广告中的关闭键设置是否合理, @19、关于开屏广告的关闭键设置，您认为以下哪]\n",
       "Index: []\n",
       "\n",
       "[0 rows x 25 columns]"
      ]
     },
     "execution_count": 95,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#### 查看所有空白值\n",
    "temp = df1[df1.isnull().T.any()]\n",
    "temp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [],
   "source": [
    "#### 删除列\n",
    "df2 = df1.drop(columns='来源详情')\n",
    "temp = df2[df2.isnull().T.any()]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "16      124.119.69.67(新疆-伊犁)\n",
       "41     116.178.42.218(新疆-哈密)\n",
       "55     61.178.103.144(甘肃-兰州)\n",
       "76     61.178.103.144(甘肃-兰州)\n",
       "90     61.178.103.146(甘肃-兰州)\n",
       "94      210.26.15.146(甘肃-兰州)\n",
       "112    39.144.210.110(甘肃-兰州)\n",
       "113    61.178.103.140(甘肃-兰州)\n",
       "118    61.178.103.141(甘肃-兰州)\n",
       "127      42.88.166.65(甘肃-陇南)\n",
       "135    61.178.223.215(甘肃-兰州)\n",
       "141     42.63.135.72(宁夏-石嘴山)\n",
       "147    61.178.103.141(甘肃-兰州)\n",
       "193    61.178.103.149(甘肃-兰州)\n",
       "196    61.178.103.144(甘肃-兰州)\n",
       "204     39.144.227.84(贵州-铜仁)\n",
       "226    61.178.223.217(甘肃-兰州)\n",
       "230    61.178.103.140(甘肃-兰州)\n",
       "231     210.26.15.139(甘肃-兰州)\n",
       "240     42.63.135.72(宁夏-石嘴山)\n",
       "244    36.142.181.101(甘肃-兰州)\n",
       "258    61.178.223.210(甘肃-兰州)\n",
       "259     36.142.178.31(甘肃-兰州)\n",
       "291    61.178.103.143(甘肃-兰州)\n",
       "297     210.26.15.149(甘肃-兰州)\n",
       "298    61.178.103.149(甘肃-兰州)\n",
       "333     223.73.66.167(广东-广州)\n",
       "371     223.73.66.174(广东-广州)\n",
       "378     223.73.66.186(广东-广州)\n",
       "407     223.73.66.157(广东-广州)\n",
       "420    116.178.42.218(新疆-哈密)\n",
       "428    117.188.10.173(贵州-贵阳)\n",
       "429    117.188.10.173(贵州-贵阳)\n",
       "430    117.188.10.173(贵州-贵阳)\n",
       "Name: 来自IP, dtype: object"
      ]
     },
     "execution_count": 97,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 重复值处理\n",
    "df2[df2.duplicated(subset=['来自IP'],keep='first')]['来自IP']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [],
   "source": [
    "#### 删除重复值\n",
    "df3 = df2.drop_duplicates(subset=['来自IP'],keep='first')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>序号</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>提交答卷时间</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>所用时间</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来源</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来自IP</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@1、您的性别</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@2、您每天使用手机的频率</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@3、您最常遇到开屏广告的APP类型是？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@4、您一天内在手机APP上看到开屏广告的次数是</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@5、您对哪类APP中的开屏广告更感兴趣？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@6、遇到APP开屏广告时，您的习惯一般是</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@7、您对APP开屏广告的态度是</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@8、您觉得多长时间的开屏广告能接受？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@9、您对APP开屏广告所表达的产品品牌活动信息</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@10、您对手机APP开屏广告的内容印象程度是</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@11、哪一类的开屏广告会吸引您的注意？【多选</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@12、您是否通过APP开屏广告主动接触其介绍的产</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@13、您认为APP开屏广告存在哪些问题？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@14、开屏广告是否影响了您的正常浏览体验</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@15、您认为每个APP开屏广告每天出现的次数最好</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@16、您觉得开屏广告的时间最好控制在</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@17、您认为APP开屏广告是否侵犯了您的隐私（如</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@18、您认为开屏广告中的关闭键设置是否合理</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>@19、关于开屏广告的关闭键设置，您认为以下哪</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                0\n",
       "序号                         object\n",
       "提交答卷时间                     object\n",
       "所用时间                       object\n",
       "来源                         object\n",
       "来自IP                       object\n",
       "@1、您的性别                    object\n",
       "@2、您每天使用手机的频率              object\n",
       "@3、您最常遇到开屏广告的APP类型是？       object\n",
       "@4、您一天内在手机APP上看到开屏广告的次数是   object\n",
       "@5、您对哪类APP中的开屏广告更感兴趣？      object\n",
       "@6、遇到APP开屏广告时，您的习惯一般是      object\n",
       "@7、您对APP开屏广告的态度是           object\n",
       "@8、您觉得多长时间的开屏广告能接受？        object\n",
       "@9、您对APP开屏广告所表达的产品品牌活动信息   object\n",
       "@10、您对手机APP开屏广告的内容印象程度是    object\n",
       "@11、哪一类的开屏广告会吸引您的注意？【多选    object\n",
       "@12、您是否通过APP开屏广告主动接触其介绍的产  object\n",
       "@13、您认为APP开屏广告存在哪些问题？      object\n",
       "@14、开屏广告是否影响了您的正常浏览体验      object\n",
       "@15、您认为每个APP开屏广告每天出现的次数最好  object\n",
       "@16、您觉得开屏广告的时间最好控制在        object\n",
       "@17、您认为APP开屏广告是否侵犯了您的隐私（如  object\n",
       "@18、您认为开屏广告中的关闭键设置是否合理     object\n",
       "@19、关于开屏广告的关闭键设置，您认为以下哪    object"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3.dtypes.to_frame()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 重命名变量\n",
    "df4 = df3.rename(columns={\n",
    "    '@1、您的性别': '性别',\n",
    "    '@2、您每天使用手机的频率': '每天手机使用频率',\n",
    "    '@3、您最常遇到开屏广告的APP类型是？':'最常接触开屏广告的APP类型',\n",
    "    '@4、您一天内在手机APP上看到开屏广告的次数是':'日均接触开屏广告次数',\n",
    "    '@5、您对哪类APP中的开屏广告更感兴趣？':'开屏广告类型偏好',\n",
    "    '@6、遇到APP开屏广告时，您的习惯一般是':'开屏广告操作习惯',\n",
    "    '@7、您对APP开屏广告的态度是':'开屏广告态度',\n",
    "    '@8、您觉得多长时间的开屏广告能接受？':'开屏广告接收时长',\n",
    "    '@9、您对APP开屏广告所表达的产品品牌活动信息':'开屏广告受众自评感知效果1',\n",
    "    '@10、您对手机APP开屏广告的内容印象程度是':'开屏广告受众自评感知效果2',\n",
    "    '@11、哪一类的开屏广告会吸引您的注意？【多选':'有效开屏广告特征',\n",
    "    '@12、您是否通过APP开屏广告主动接触其介绍的产':'开屏广告受众自评行动效果',\n",
    "    '@13、您认为APP开屏广告存在哪些问题？':'开屏广告存在问题',\n",
    "    '@14、开屏广告是否影响了您的正常浏览体验':'开屏广告浏览体验',\n",
    "    '@15、您认为每个APP开屏广告每天出现的次数最好':'开屏广告建议次数',\n",
    "    '@16、您觉得开屏广告的时间最好控制在':'开屏广告建议时长',\n",
    "    '@17、您认为APP开屏广告是否侵犯了您的隐私（如':'开屏广告隐私侵犯感',\n",
    "    '@18、您认为开屏广告中的关闭键设置是否合理':'开屏广告关闭键评价',\n",
    "    '@19、关于开屏广告的关闭键设置，您认为以下哪':'开屏广告关闭键改进建议',\n",
    "})\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>所用时间</th>\n",
       "      <th>填写问卷时长</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>71秒</td>\n",
       "      <td>71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>108秒</td>\n",
       "      <td>108</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>81秒</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   所用时间 填写问卷时长\n",
       "0   71秒     71\n",
       "1  108秒    108\n",
       "2   81秒     81"
      ]
     },
     "execution_count": 101,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"\"\" 重新生成变量 \"\"\"\n",
    "df4['填写问卷时长'] = df4['所用时间'].str.rstrip('秒')\n",
    "df4[['所用时间','填写问卷时长']].head(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>日均接触开屏广告次数</th>\n",
       "      <th>开屏广告受众自评感知效果2</th>\n",
       "      <th>开屏广告建议次数</th>\n",
       "      <th>开屏广告建议时长</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>5-7</td>\n",
       "      <td>完全没印象</td>\n",
       "      <td>0次（烦人的广告，没有最好了)</td>\n",
       "      <td>3秒及以下（一闪而过）</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3-5</td>\n",
       "      <td>一般印象</td>\n",
       "      <td>2次给人多留点赚广告费)</td>\n",
       "      <td>5秒（看清楚了）</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1-3</td>\n",
       "      <td>完全没印象</td>\n",
       "      <td>0次（烦人的广告，没有最好了)</td>\n",
       "      <td>3秒及以下（一闪而过）</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  日均接触开屏广告次数 开屏广告受众自评感知效果2         开屏广告建议次数     开屏广告建议时长\n",
       "0        5-7         完全没印象  0次（烦人的广告，没有最好了)  3秒及以下（一闪而过）\n",
       "1        3-5          一般印象     2次给人多留点赚广告费)     5秒（看清楚了）\n",
       "2        1-3         完全没印象  0次（烦人的广告，没有最好了)  3秒及以下（一闪而过）"
      ]
     },
     "execution_count": 102,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df4['日均接触开屏广告次数'] = df4['日均接触开屏广告次数'].str.lstrip('○')\n",
    "df4['开屏广告受众自评感知效果2'] = df4['开屏广告受众自评感知效果2'].str.lstrip('○')\n",
    "df4['开屏广告建议次数'] = df4['开屏广告建议次数'].str.lstrip('○')\n",
    "df4['开屏广告建议时长'] = df4['开屏广告建议时长'].str.lstrip('○')\n",
    "df4[['日均接触开屏广告次数','开屏广告受众自评感知效果2','开屏广告建议次数','开屏广告建议时长']].head(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>序号</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>提交答卷时间</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>所用时间</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来源</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来自IP</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>性别</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>每天手机使用频率</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>最常接触开屏广告的APP类型</th>\n",
       "      <td>string</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日均接触开屏广告次数</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告类型偏好</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告操作习惯</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告态度</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告接收时长</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告受众自评感知效果1</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告受众自评感知效果2</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>有效开屏广告特征</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告受众自评行动效果</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告存在问题</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告浏览体验</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告建议次数</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告建议时长</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告隐私侵犯感</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告关闭键评价</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告关闭键改进建议</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>填写问卷时长</th>\n",
       "      <td>int32</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                       0\n",
       "序号                object\n",
       "提交答卷时间            object\n",
       "所用时间              object\n",
       "来源                object\n",
       "来自IP              object\n",
       "性别              category\n",
       "每天手机使用频率        category\n",
       "最常接触开屏广告的APP类型    string\n",
       "日均接触开屏广告次数      category\n",
       "开屏广告类型偏好        category\n",
       "开屏广告操作习惯        category\n",
       "开屏广告态度          category\n",
       "开屏广告接收时长        category\n",
       "开屏广告受众自评感知效果1   category\n",
       "开屏广告受众自评感知效果2   category\n",
       "有效开屏广告特征        category\n",
       "开屏广告受众自评行动效果    category\n",
       "开屏广告存在问题        category\n",
       "开屏广告浏览体验        category\n",
       "开屏广告建议次数        category\n",
       "开屏广告建议时长        category\n",
       "开屏广告隐私侵犯感       category\n",
       "开屏广告关闭键评价       category\n",
       "开屏广告关闭键改进建议     category\n",
       "填写问卷时长             int32"
      ]
     },
     "execution_count": 103,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 使用astypes方法设定变量的类型\n",
    "df5 = df4.astype({\n",
    "    '性别': 'category',\n",
    "    '填写问卷时长': 'int',\n",
    "    '每天手机使用频率': 'category',\n",
    "    '最常接触开屏广告的APP类型': 'string',\n",
    "    '日均接触开屏广告次数': 'category',\n",
    "    '开屏广告类型偏好': 'category',\n",
    "    '开屏广告操作习惯': 'category',\n",
    "    '开屏广告态度': 'category',\n",
    "    '开屏广告接收时长': 'category',\n",
    "    '开屏广告受众自评感知效果1': 'category',\n",
    "    '开屏广告受众自评感知效果2': 'category',\n",
    "    '有效开屏广告特征': 'category',\n",
    "    '开屏广告受众自评行动效果': 'category',\n",
    "    '开屏广告存在问题': 'category',\n",
    "    '开屏广告浏览体验': 'category',\n",
    "    '开屏广告建议次数': 'category',\n",
    "    '开屏广告建议时长': 'category',\n",
    "    '开屏广告隐私侵犯感': 'category',\n",
    "    '开屏广告关闭键评价': 'category',\n",
    "    '开屏广告关闭键改进建议': 'category',\n",
    "})\n",
    "df5.dtypes.to_frame()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {},
   "outputs": [],
   "source": [
    "df5['每天手机使用频率'] = df5['每天手机使用频率'].cat.reorder_categories(['很少使用（2小时以下）',\"偶尔使用（2-4小时）\" ,\"经常使用（4-8小时）\", \"重度使用（8小时以上）\"], ordered=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count     403.000000\n",
       "mean      130.684864\n",
       "std       135.326204\n",
       "min        18.000000\n",
       "25%        82.000000\n",
       "50%       107.000000\n",
       "75%       146.500000\n",
       "max      1995.000000\n",
       "Name: 填写问卷时长, dtype: float64"
      ]
     },
     "execution_count": 105,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df5['填写问卷时长'].describe()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "填写问卷时长=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa"
         },
         "name": "",
         "notched": false,
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "type": "box",
         "x0": " ",
         "xaxis": "x",
         "y": [
          71,
          108,
          81,
          86,
          83,
          240,
          134,
          97,
          108,
          130,
          60,
          93,
          63,
          21,
          56,
          138,
          94,
          120,
          589,
          107,
          171,
          195,
          146,
          99,
          83,
          49,
          53,
          127,
          88,
          68,
          109,
          85,
          74,
          163,
          131,
          95,
          94,
          127,
          112,
          103,
          59,
          158,
          109,
          60,
          56,
          81,
          82,
          73,
          82,
          82,
          104,
          105,
          170,
          59,
          59,
          112,
          37,
          155,
          116,
          91,
          181,
          56,
          81,
          91,
          73,
          75,
          127,
          80,
          76,
          68,
          95,
          196,
          93,
          92,
          155,
          121,
          144,
          84,
          110,
          136,
          60,
          23,
          82,
          99,
          98,
          71,
          115,
          57,
          162,
          112,
          70,
          65,
          84,
          95,
          70,
          107,
          166,
          55,
          80,
          101,
          122,
          48,
          148,
          33,
          86,
          74,
          115,
          131,
          92,
          49,
          96,
          226,
          83,
          218,
          187,
          204,
          204,
          162,
          53,
          265,
          112,
          88,
          270,
          70,
          83,
          92,
          67,
          97,
          130,
          78,
          106,
          81,
          145,
          129,
          174,
          584,
          122,
          52,
          86,
          145,
          111,
          144,
          116,
          55,
          89,
          300,
          157,
          165,
          24,
          67,
          91,
          138,
          80,
          100,
          98,
          82,
          153,
          57,
          87,
          85,
          117,
          29,
          73,
          240,
          83,
          54,
          118,
          128,
          78,
          93,
          135,
          117,
          113,
          48,
          144,
          48,
          106,
          166,
          128,
          145,
          103,
          77,
          85,
          110,
          121,
          95,
          120,
          104,
          148,
          152,
          73,
          102,
          171,
          160,
          146,
          62,
          30,
          184,
          177,
          93,
          78,
          72,
          120,
          109,
          112,
          302,
          131,
          63,
          67,
          394,
          102,
          28,
          85,
          124,
          136,
          68,
          75,
          147,
          133,
          123,
          89,
          83,
          124,
          138,
          101,
          122,
          193,
          105,
          376,
          45,
          182,
          111,
          210,
          68,
          76,
          85,
          268,
          91,
          228,
          196,
          129,
          118,
          136,
          102,
          172,
          104,
          96,
          82,
          96,
          188,
          86,
          76,
          86,
          152,
          112,
          80,
          257,
          108,
          77,
          94,
          105,
          151,
          162,
          186,
          53,
          79,
          198,
          101,
          123,
          102,
          127,
          87,
          64,
          113,
          86,
          141,
          177,
          97,
          58,
          187,
          235,
          165,
          186,
          202,
          67,
          255,
          91,
          335,
          324,
          123,
          80,
          100,
          147,
          70,
          124,
          139,
          184,
          74,
          123,
          184,
          64,
          69,
          110,
          157,
          117,
          55,
          91,
          82,
          102,
          84,
          90,
          204,
          101,
          124,
          111,
          160,
          108,
          233,
          79,
          94,
          181,
          53,
          146,
          74,
          163,
          172,
          128,
          171,
          120,
          131,
          72,
          95,
          133,
          1995,
          126,
          45,
          83,
          112,
          163,
          125,
          132,
          204,
          59,
          116,
          102,
          163,
          120,
          628,
          87,
          84,
          454,
          105,
          204,
          70,
          110,
          40,
          181,
          150,
          148,
          207,
          211,
          65,
          89,
          75,
          162,
          91,
          136,
          304,
          61,
          147,
          153,
          143,
          158,
          209,
          236,
          114,
          214,
          378,
          88,
          89,
          52,
          113,
          18,
          98,
          83,
          164,
          95,
          110,
          80,
          1451,
          50,
          94,
          54,
          270,
          145,
          129,
          64,
          178,
          169,
          146,
          97,
          175,
          116
         ],
         "y0": " ",
         "yaxis": "y"
        }
       ],
       "layout": {
        "boxmode": "group",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ]
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "填写问卷时长"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.box(df5, y=\"填写问卷时长\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "bingroup": "x",
         "hovertemplate": "填写问卷时长=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "type": "histogram",
         "x": [
          71,
          108,
          81,
          86,
          83,
          240,
          134,
          97,
          108,
          130,
          60,
          93,
          63,
          21,
          56,
          138,
          94,
          120,
          589,
          107,
          171,
          195,
          146,
          99,
          83,
          49,
          53,
          127,
          88,
          68,
          109,
          85,
          74,
          163,
          131,
          95,
          94,
          127,
          112,
          103,
          59,
          158,
          109,
          60,
          56,
          81,
          82,
          73,
          82,
          82,
          104,
          105,
          170,
          59,
          59,
          112,
          37,
          155,
          116,
          91,
          181,
          56,
          81,
          91,
          73,
          75,
          127,
          80,
          76,
          68,
          95,
          196,
          93,
          92,
          155,
          121,
          144,
          84,
          110,
          136,
          60,
          23,
          82,
          99,
          98,
          71,
          115,
          57,
          162,
          112,
          70,
          65,
          84,
          95,
          70,
          107,
          166,
          55,
          80,
          101,
          122,
          48,
          148,
          33,
          86,
          74,
          115,
          131,
          92,
          49,
          96,
          226,
          83,
          218,
          187,
          204,
          204,
          162,
          53,
          265,
          112,
          88,
          270,
          70,
          83,
          92,
          67,
          97,
          130,
          78,
          106,
          81,
          145,
          129,
          174,
          584,
          122,
          52,
          86,
          145,
          111,
          144,
          116,
          55,
          89,
          300,
          157,
          165,
          24,
          67,
          91,
          138,
          80,
          100,
          98,
          82,
          153,
          57,
          87,
          85,
          117,
          29,
          73,
          240,
          83,
          54,
          118,
          128,
          78,
          93,
          135,
          117,
          113,
          48,
          144,
          48,
          106,
          166,
          128,
          145,
          103,
          77,
          85,
          110,
          121,
          95,
          120,
          104,
          148,
          152,
          73,
          102,
          171,
          160,
          146,
          62,
          30,
          184,
          177,
          93,
          78,
          72,
          120,
          109,
          112,
          302,
          131,
          63,
          67,
          394,
          102,
          28,
          85,
          124,
          136,
          68,
          75,
          147,
          133,
          123,
          89,
          83,
          124,
          138,
          101,
          122,
          193,
          105,
          376,
          45,
          182,
          111,
          210,
          68,
          76,
          85,
          268,
          91,
          228,
          196,
          129,
          118,
          136,
          102,
          172,
          104,
          96,
          82,
          96,
          188,
          86,
          76,
          86,
          152,
          112,
          80,
          257,
          108,
          77,
          94,
          105,
          151,
          162,
          186,
          53,
          79,
          198,
          101,
          123,
          102,
          127,
          87,
          64,
          113,
          86,
          141,
          177,
          97,
          58,
          187,
          235,
          165,
          186,
          202,
          67,
          255,
          91,
          335,
          324,
          123,
          80,
          100,
          147,
          70,
          124,
          139,
          184,
          74,
          123,
          184,
          64,
          69,
          110,
          157,
          117,
          55,
          91,
          82,
          102,
          84,
          90,
          204,
          101,
          124,
          111,
          160,
          108,
          233,
          79,
          94,
          181,
          53,
          146,
          74,
          163,
          172,
          128,
          171,
          120,
          131,
          72,
          95,
          133,
          1995,
          126,
          45,
          83,
          112,
          163,
          125,
          132,
          204,
          59,
          116,
          102,
          163,
          120,
          628,
          87,
          84,
          454,
          105,
          204,
          70,
          110,
          40,
          181,
          150,
          148,
          207,
          211,
          65,
          89,
          75,
          162,
          91,
          136,
          304,
          61,
          147,
          153,
          143,
          158,
          209,
          236,
          114,
          214,
          378,
          88,
          89,
          52,
          113,
          18,
          98,
          83,
          164,
          95,
          110,
          80,
          1451,
          50,
          94,
          54,
          270,
          145,
          129,
          64,
          178,
          169,
          146,
          97,
          175,
          116
         ],
         "xaxis": "x",
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "填写问卷时长"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "count"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.histogram(df5, x=\"填写问卷时长\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "metadata": {},
   "outputs": [],
   "source": [
    "\"\"\"删除填写时间过短及过长的的数据\"\"\"\n",
    "df6 = df5.drop(index = df5.query('(填写问卷时长 <= 40) or (填写问卷时长 > 600)').index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "bingroup": "x",
         "hovertemplate": "填写问卷时长=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "type": "histogram",
         "x": [
          71,
          108,
          81,
          86,
          83,
          240,
          134,
          97,
          108,
          130,
          60,
          93,
          63,
          56,
          138,
          94,
          120,
          589,
          107,
          171,
          195,
          146,
          99,
          83,
          49,
          53,
          127,
          88,
          68,
          109,
          85,
          74,
          163,
          131,
          95,
          94,
          127,
          112,
          103,
          59,
          158,
          109,
          60,
          56,
          81,
          82,
          73,
          82,
          82,
          104,
          105,
          170,
          59,
          59,
          112,
          155,
          116,
          91,
          181,
          56,
          81,
          91,
          73,
          75,
          127,
          80,
          76,
          68,
          95,
          196,
          93,
          92,
          155,
          121,
          144,
          84,
          110,
          136,
          60,
          82,
          99,
          98,
          71,
          115,
          57,
          162,
          112,
          70,
          65,
          84,
          95,
          70,
          107,
          166,
          55,
          80,
          101,
          122,
          48,
          148,
          86,
          74,
          115,
          131,
          92,
          49,
          96,
          226,
          83,
          218,
          187,
          204,
          204,
          162,
          53,
          265,
          112,
          88,
          270,
          70,
          83,
          92,
          67,
          97,
          130,
          78,
          106,
          81,
          145,
          129,
          174,
          584,
          122,
          52,
          86,
          145,
          111,
          144,
          116,
          55,
          89,
          300,
          157,
          165,
          67,
          91,
          138,
          80,
          100,
          98,
          82,
          153,
          57,
          87,
          85,
          117,
          73,
          240,
          83,
          54,
          118,
          128,
          78,
          93,
          135,
          117,
          113,
          48,
          144,
          48,
          106,
          166,
          128,
          145,
          103,
          77,
          85,
          110,
          121,
          95,
          120,
          104,
          148,
          152,
          73,
          102,
          171,
          160,
          146,
          62,
          184,
          177,
          93,
          78,
          72,
          120,
          109,
          112,
          302,
          131,
          63,
          67,
          394,
          102,
          85,
          124,
          136,
          68,
          75,
          147,
          133,
          123,
          89,
          83,
          124,
          138,
          101,
          122,
          193,
          105,
          376,
          45,
          182,
          111,
          210,
          68,
          76,
          85,
          268,
          91,
          228,
          196,
          129,
          118,
          136,
          102,
          172,
          104,
          96,
          82,
          96,
          188,
          86,
          76,
          86,
          152,
          112,
          80,
          257,
          108,
          77,
          94,
          105,
          151,
          162,
          186,
          53,
          79,
          198,
          101,
          123,
          102,
          127,
          87,
          64,
          113,
          86,
          141,
          177,
          97,
          58,
          187,
          235,
          165,
          186,
          202,
          67,
          255,
          91,
          335,
          324,
          123,
          80,
          100,
          147,
          70,
          124,
          139,
          184,
          74,
          123,
          184,
          64,
          69,
          110,
          157,
          117,
          55,
          91,
          82,
          102,
          84,
          90,
          204,
          101,
          124,
          111,
          160,
          108,
          233,
          79,
          94,
          181,
          53,
          146,
          74,
          163,
          172,
          128,
          171,
          120,
          131,
          72,
          95,
          133,
          126,
          45,
          83,
          112,
          163,
          125,
          132,
          204,
          59,
          116,
          102,
          163,
          120,
          87,
          84,
          454,
          105,
          204,
          70,
          110,
          181,
          150,
          148,
          207,
          211,
          65,
          89,
          75,
          162,
          91,
          136,
          304,
          61,
          147,
          153,
          143,
          158,
          209,
          236,
          114,
          214,
          378,
          88,
          89,
          52,
          113,
          98,
          83,
          164,
          95,
          110,
          80,
          50,
          94,
          54,
          270,
          145,
          129,
          64,
          178,
          169,
          146,
          97,
          175,
          116
         ],
         "xaxis": "x",
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "填写问卷时长"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "count"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.histogram(df6, x=\"填写问卷时长\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "女    265\n",
      "男    125\n",
      "Name: 性别, dtype: int64\n",
      "经常使用（4-8小时）    190\n",
      "重度使用（8小时以上）    172\n",
      "偶尔使用（2-4小时）     24\n",
      "很少使用（2小时以下）      4\n",
      "Name: 每天手机使用频率, dtype: int64\n",
      "7次及以上    154\n",
      "3-5      101\n",
      "1-3       63\n",
      "5-7       60\n",
      "0次        12\n",
      "Name: 日均接触开屏广告次数, dtype: int64\n",
      "其他       136\n",
      "休闲娱乐类     91\n",
      "美妆护肤类     64\n",
      "数码产品类     37\n",
      "服装鞋包类     35\n",
      "生活用品类     27\n",
      "Name: 开屏广告类型偏好, dtype: int64\n",
      "直接点击跳过       361\n",
      "等待广告自动结束      24\n",
      "观看广告并点击查看      5\n",
      "Name: 开屏广告操作习惯, dtype: int64\n",
      "很讨厌    278\n",
      "不介意    105\n",
      "很喜欢      7\n",
      "Name: 开屏广告态度, dtype: int64\n",
      "没有广告    250\n",
      "1-3秒     96\n",
      "3-5秒     39\n",
      "5秒以上      5\n",
      "Name: 开屏广告接收时长, dtype: int64\n",
      "一般理解     195\n",
      "完全不理解    137\n",
      "比较理解      53\n",
      "深刻理解       5\n",
      "Name: 开屏广告受众自评感知效果1, dtype: int64\n",
      "一般印象     157\n",
      "比较没印象     92\n",
      "完全没印象     86\n",
      "比较深       34\n",
      "非常深       21\n",
      "Name: 开屏广告受众自评感知效果2, dtype: int64\n",
      "单纯根据个人喜爱                                                   108\n",
      "喜欢的明星代言                                                     26\n",
      "广告内容较感兴趣                                                    17\n",
      "画面色彩比较丰富                                                    17\n",
      "画面色彩比较丰富┋单纯根据个人喜爱                                           16\n",
      "                                                          ... \n",
      "画面色彩比较丰富┋单纯根据个人喜爱┋广告内容较感兴趣┋喜欢的明星代言┋动态图片                      1\n",
      "画面色彩比较丰富┋单纯根据个人喜爱┋广告内容较感兴趣┋喜欢的明星代言┋有较大活动力度的广告┋动态图片┋视频广告      1\n",
      "广告内容较感兴趣┋喜欢的明星代言┋视频广告                                        1\n",
      "静态图片┋动态图片┋视频广告                                               1\n",
      "单纯根据个人喜爱┋广告内容较感兴趣┋喜欢的明星代言┋静态图片                               0\n",
      "Name: 有效开屏广告特征, Length: 89, dtype: int64\n",
      "否    263\n",
      "是    127\n",
      "Name: 开屏广告受众自评行动效果, dtype: int64\n",
      "有的不能点击跳过广告┋容易误触跳转到其他APP┋过度推广，容易误导消费者       102\n",
      "容易误触跳转到其他APP                                62\n",
      "有的不能点击跳过广告┋容易误触跳转到其他APP                     60\n",
      "容易误触跳转到其他APP┋过度推广，容易误导消费者                   48\n",
      "有的不能点击跳过广告┋容易误触跳转到其他APP┋过度推广，容易误导消费者┋其他     46\n",
      "有的不能点击跳过广告                                  22\n",
      "其他                                          18\n",
      "过度推广，容易误导消费者                                13\n",
      "容易误触跳转到其他APP┋其他                              7\n",
      "有的不能点击跳过广告┋过度推广，容易误导消费者                      4\n",
      "容易误触跳转到其他APP┋过度推广，容易误导消费者┋其他                 3\n",
      "有的不能点击跳过广告┋容易误触跳转到其他APP┋其他                   3\n",
      "有的不能点击跳过广告┋其他                                2\n",
      "Name: 开屏广告存在问题, dtype: int64\n",
      "有点影响     165\n",
      "非常影响     123\n",
      "比较影响      83\n",
      "完全不影响     19\n",
      "Name: 开屏广告浏览体验, dtype: int64\n",
      "0次（烦人的广告，没有最好了)            199\n",
      "1次给人留点赚广告费)                122\n",
      "2次给人多留点赚广告费)                59\n",
      "3次及以上（反正不影响我，出现多少次都没关系）     10\n",
      "Name: 开屏广告建议次数, dtype: int64\n",
      "3秒及以下（一闪而过）      272\n",
      "4秒勉强看清)           66\n",
      "5秒（看清楚了）          42\n",
      "6秒及以上（仔细看清楚了）     10\n",
      "Name: 开屏广告建议时长, dtype: int64\n",
      "是    274\n",
      "否    116\n",
      "Name: 开屏广告隐私侵犯感, dtype: int64\n",
      "是    205\n",
      "否    185\n",
      "Name: 开屏广告关闭键评价, dtype: int64\n",
      "关闭键位于明显处        247\n",
      "关机键在广告开启时便出现     84\n",
      "关闭键有动态提示         30\n",
      "关闭键不明显           29\n",
      "Name: 开屏广告关闭键改进建议, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "\"\"\" 列出所有类别变量取值 \"\"\"\n",
    "mytools.print_all_cats(df6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 逻辑一致性清理\n",
    "\n",
    "df7 = df6.drop(df6.query('日均接触开屏广告次数 == \"0次\"').index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 数据清理完毕\n",
    "df = df7.copy()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据分析\n",
    "\n",
    "### 描述统计\n",
    "\n",
    "先描述样本背景，对样本质量进行评价。再描述样本特征信息、样本基本现状，最后描述样本基本态度及其他维度。\n",
    "\n",
    "描述统计分析也应该有理论依据或概念合理的分类。\n",
    "\n",
    "### 推论统计\n",
    "\n",
    "可进行一些相关性、差异性分析以及回归分析。合理分析变量之间的相关性。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 样本背景\n",
    "\n",
    "本次描述性研究的样本背景变量只有一个，即性别，将样本的性别比例与总体的性别比例进行对比，可进行样本质量的评估。\n",
    "\n",
    "需要汇报数据获取方式（时间、渠道、样本量、有效样本量），"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "86.49885583524028"
      ]
     },
     "execution_count": 113,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "样本量 = df1.shape[0]\n",
    "有效样本量 = df.shape[0]\n",
    "有效回收率 = 有效样本量/样本量 * 100\n",
    "# 有效回收率在50%以上就可以接收。\n",
    "有效回收率"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>性别</th>\n",
       "      <th>个数</th>\n",
       "      <th>百分比</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>女</td>\n",
       "      <td>259</td>\n",
       "      <td>68.52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>男</td>\n",
       "      <td>119</td>\n",
       "      <td>31.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>总和</td>\n",
       "      <td>378</td>\n",
       "      <td>100.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   性别   个数     百分比\n",
       "0   女  259   68.52\n",
       "1   男  119   31.48\n",
       "2  总和  378  100.00"
      ]
     },
     "execution_count": 114,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 样本特征（性别）与总体特征的对比\n",
    "mytools.gen_percent_table(df,'性别')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "样本中男女比例为68：32，与总体中的51:49有差距，因XXXX的原因，导致样本中的性别出现了上述偏差，但XXXX，故可认为样本的质量XXX。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 样本特征分析\n",
    "\n",
    "所谓样本特征，就是与研究目的相关的一些变量，如媒介接触行为、广告接触行为等等。\n",
    "\n",
    "本次研究中，相关的题目为：“第2题：您每天使用手机的频率[单选题]”"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "CategoricalDtype(categories=['很少使用（2小时以下）', '偶尔使用（2-4小时）', '经常使用（4-8小时）', '重度使用（8小时以上）'], ordered=True)"
      ]
     },
     "execution_count": 115,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 确保变量类型合适\n",
    "df['每天手机使用频率'].dtype"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>每天手机使用频率</th>\n",
       "      <th>个数</th>\n",
       "      <th>百分比</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>很少使用（2小时以下）</td>\n",
       "      <td>4</td>\n",
       "      <td>1.06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>偶尔使用（2-4小时）</td>\n",
       "      <td>23</td>\n",
       "      <td>6.08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>经常使用（4-8小时）</td>\n",
       "      <td>186</td>\n",
       "      <td>49.21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>重度使用（8小时以上）</td>\n",
       "      <td>165</td>\n",
       "      <td>43.65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>总和</td>\n",
       "      <td>378</td>\n",
       "      <td>100.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      每天手机使用频率   个数     百分比\n",
       "0  很少使用（2小时以下）    4    1.06\n",
       "1  偶尔使用（2-4小时）   23    6.08\n",
       "2  经常使用（4-8小时）  186   49.21\n",
       "3  重度使用（8小时以上）  165   43.65\n",
       "4           总和  378  100.00"
      ]
     },
     "execution_count": 116,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mytools.gen_percent_table(df,'每天手机使用频率',sort=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "metadata": {},
   "outputs": [],
   "source": [
    "result = df['每天手机使用频率'].value_counts(sort=False,\n",
    "                                     normalize=True).to_frame() * 100\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "index=%{x}<br>每天手机使用频率=%{text}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "text": [
          1.0582010582010581,
          6.084656084656085,
          49.2063492063492,
          43.65079365079365
         ],
         "textposition": "outside",
         "texttemplate": "%{text:.1f}%",
         "type": "bar",
         "x": [
          "很少使用（2小时以下）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）"
         ],
         "xaxis": "x",
         "y": [
          1.0582010582010581,
          6.084656084656085,
          49.2063492063492,
          43.65079365079365
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "height": 500,
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "white",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "white",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "#C8D4E3",
             "linecolor": "#C8D4E3",
             "minorgridcolor": "#C8D4E3",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "#C8D4E3",
             "linecolor": "#C8D4E3",
             "minorgridcolor": "#C8D4E3",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "white",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "#C8D4E3"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "white",
          "polar": {
           "angularaxis": {
            "gridcolor": "#EBF0F8",
            "linecolor": "#EBF0F8",
            "ticks": ""
           },
           "bgcolor": "white",
           "radialaxis": {
            "gridcolor": "#EBF0F8",
            "linecolor": "#EBF0F8",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "white",
            "gridcolor": "#DFE8F3",
            "gridwidth": 2,
            "linecolor": "#EBF0F8",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "#EBF0F8"
           },
           "yaxis": {
            "backgroundcolor": "white",
            "gridcolor": "#DFE8F3",
            "gridwidth": 2,
            "linecolor": "#EBF0F8",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "#EBF0F8"
           },
           "zaxis": {
            "backgroundcolor": "white",
            "gridcolor": "#DFE8F3",
            "gridwidth": 2,
            "linecolor": "#EBF0F8",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "#EBF0F8"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "#DFE8F3",
            "linecolor": "#A2B1C6",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "#DFE8F3",
            "linecolor": "#A2B1C6",
            "ticks": ""
           },
           "bgcolor": "white",
           "caxis": {
            "gridcolor": "#DFE8F3",
            "linecolor": "#A2B1C6",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "#EBF0F8",
           "linecolor": "#EBF0F8",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "#EBF0F8",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "#EBF0F8",
           "linecolor": "#EBF0F8",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "#EBF0F8",
           "zerolinewidth": 2
          }
         }
        },
        "width": 700,
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "每天手机使用频率"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "range": [
          0,
          60
         ],
         "title": {
          "text": "比例(%)"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(\n",
    "    result,\n",
    "    x=result.index,\n",
    "    y='每天手机使用频率',\n",
    "    text='每天手机使用频率',\n",
    "    text_auto=True,\n",
    "    range_y=[0, 60],\n",
    "    width=700,\n",
    "    height=500,\n",
    "    template='plotly_white'\n",
    ")\n",
    "fig.update_traces(\n",
    "    texttemplate='%{text:.1f}%',\n",
    "    textposition='outside',\n",
    ")\n",
    "fig.update_layout(\n",
    "    xaxis_title=\"每天手机使用频率\",\n",
    "    yaxis_title=\"比例(%)\",\n",
    ")\n",
    "fig.write_image(\"fig1.svg\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "构造作图用数据框\n",
    "\n",
    "|index|每天手机使用频率|性别|次数|比例|\n",
    "|--|--|--|--|--|\n",
    "|1|很少|男|20|21.3|\n",
    "|2|很少|男|20|21.3|\n",
    "|3|很少|女|20|21.3|\n",
    "|4|很少|女|20|21.3|\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 139,
   "metadata": {},
   "outputs": [],
   "source": [
    "temp = df['每天手机使用频率'].value_counts(sort=False,\n",
    "                                     ).to_frame()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 141,
   "metadata": {},
   "outputs": [],
   "source": [
    "d = pd.DataFrame(data=np.zeros([temp.shape[0],4]),columns=['每天使用手机频率','性别','数值','比例'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=男<br>每天手机使用频率=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "男",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "男",
         "offsetgroup": "男",
         "orientation": "v",
         "showlegend": true,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "很少使用（2小时以下）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "很少使用（2小时以下）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）"
         ],
         "xaxis": "x",
         "y": [
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1
         ],
         "yaxis": "y"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=女<br>每天手机使用频率=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "女",
         "marker": {
          "color": "#EF553B",
          "pattern": {
           "shape": ""
          }
         },
         "name": "女",
         "offsetgroup": "女",
         "orientation": "v",
         "showlegend": true,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "很少使用（2小时以下）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "很少使用（2小时以下）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）"
         ],
         "xaxis": "x",
         "y": [
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "group",
        "legend": {
         "title": {
          "text": "性别"
         },
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "每天手机使用频率"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "count"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(df,x='每天手机使用频率',color='性别',barmode='group')\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 样本基本现状"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 多选题分析\n",
    "\n",
    "如果内容为“单纯根据个人喜爱┋广告内容较感兴趣┋喜欢的明星代言┋视频广告”，则统计所有类别，生成所有多选题选项的表格。\n",
    "如：\n",
    "|选项|次数|比例|\n",
    "|--|--|--|\n",
    "|单纯根据个人喜爱|20|5.56%|\n",
    "|广告内容较感兴趣|20|5.56%|\n",
    "|喜欢的明星代言|20|5.56%|\n",
    "|视频广告|20|5.56%|"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "其他\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n"
     ]
    }
   ],
   "source": [
    "## 获得多选题所有选项\n",
    "df6['test'] = df6['最常接触开屏广告的APP类型'].str.split('┋')\n",
    "df6['test'].value_counts()\n",
    "mcq_items = []\n",
    "for g in df6['test']:\n",
    "    for label in g:\n",
    "        print(label)\n",
    "        mcq_items.append(label)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "metadata": {},
   "outputs": [],
   "source": [
    "result = list(set(mcq_items))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_mcq_1 = pd.DataFrame(data=np.zeros([len(result),2]),index=result,columns=['次数','比例'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in df6['最常接触开屏广告的APP类型']:\n",
    "    for label in result:\n",
    "        if str(i).__contains__(label):\n",
    "            df_mcq_1.loc[label,'次数'] += 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "metadata": {},
   "outputs": [],
   "source": [
    "\"\"\"生成比例列\"\"\"\n",
    "df_mcq_1['比例'] = df_mcq_1['次数']/df6.shape[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 125,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_mcq_1 = df_mcq_1.sort_values(by='比例')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "比例=%{x}<br>index=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "h",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          0.1641025641025641,
          0.2076923076923077,
          0.2128205128205128,
          0.24871794871794872,
          0.24871794871794872,
          0.44358974358974357,
          0.5307692307692308,
          0.5769230769230769
         ],
         "xaxis": "x",
         "y": [
          "拍摄美化类（美图秀秀、美拍等）",
          "游戏类（消消乐、纪念碑谷等）",
          "其他",
          "便捷牛活类（美团、天气、地图等）",
          "资讯类（今日头条、知乎日报等）",
          "影音娱乐类（腾讯视频、搜影狐视频等）",
          "购物类（淘宝、京东等）",
          "社交通讯类（微信、微博、QQ等）"
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "比例"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "index"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(df_mcq_1, x=\"比例\",orientation='h')\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 127,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 定义一个针对问卷星数据多选题的分析函数\n",
    "\n",
    "\n",
    "def gen_mcq_df(df,x,pattern='┋'):\n",
    "    \"\"\"\n",
    "    定义一个针对问卷星数据多选题的分析函数\n",
    "    \n",
    "    df: 数据框\n",
    "    x: 问卷星中定义的多选题\n",
    "\n",
    "    返回值： 一个包含所有选项及出现次数和所占比例    \n",
    "    \"\"\"\n",
    "    # 按照指定分隔符将多选题字符串转化包含多个选项的列表\n",
    "    df['temp'] = df[x].str.split(pattern)\n",
    "    # 初始化列表，用于保存所有多选题选项\n",
    "    mcq_items = []\n",
    "    # 循环所有个案，获取所有多选题选项\n",
    "    for g in df['temp']:\n",
    "        for label in g:\n",
    "            # print(label)\n",
    "            mcq_items.append(label)\n",
    "    # 将多选题选项去重后转化为列表，方便构造dataframe\n",
    "    result = list(set(mcq_items))\n",
    "    # 构造包含选项、次数和比例的空表\n",
    "    df_mcq_1 = pd.DataFrame(data=np.zeros([len(result), 2]),\n",
    "                            index=result,\n",
    "                            columns=['次数', '比例'])\n",
    "    # 通过循环获取每个选项在多选题中累次出现的次数\n",
    "    for i in df[x]:\n",
    "        for label in result:\n",
    "            if str(i).__contains__(label):\n",
    "                df_mcq_1.loc[label, '次数'] += 1\n",
    "    # 生成比例列\n",
    "    df_mcq_1['比例'] = df_mcq_1['次数'] / df.shape[0] * 100\n",
    "\n",
    "    return df_mcq_1.astype({'次数':\"int\"})\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_mcq__1 = gen_mcq_df(df,'最常接触开屏广告的APP类型')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "比例=%{x}<br>index=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "h",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          0.1641025641025641,
          0.2076923076923077,
          0.2128205128205128,
          0.24871794871794872,
          0.24871794871794872,
          0.44358974358974357,
          0.5307692307692308,
          0.5769230769230769
         ],
         "xaxis": "x",
         "y": [
          "拍摄美化类（美图秀秀、美拍等）",
          "游戏类（消消乐、纪念碑谷等）",
          "其他",
          "便捷牛活类（美团、天气、地图等）",
          "资讯类（今日头条、知乎日报等）",
          "影音娱乐类（腾讯视频、搜影狐视频等）",
          "购物类（淘宝、京东等）",
          "社交通讯类（微信、微博、QQ等）"
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "比例"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "index"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df_mcq_1 = df_mcq_1.sort_values(by='比例')\n",
    "fig = px.bar(df_mcq_1, x=\"比例\",orientation='h')\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 130,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_mcq_2 = gen_mcq_df(df,'有效开屏广告特征')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "比例=%{x}<br>index=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "h",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          8.465608465608465,
          11.904761904761903,
          12.16931216931217,
          15.343915343915343,
          29.100529100529098,
          29.365079365079367,
          31.216931216931215,
          65.34391534391534
         ],
         "xaxis": "x",
         "y": [
          "静态图片",
          "动态图片",
          "视频广告",
          "有较大活动力度的广告",
          "喜欢的明星代言",
          "画面色彩比较丰富",
          "广告内容较感兴趣",
          "单纯根据个人喜爱"
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "比例"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "index"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df_mcq_2 = df_mcq_2.sort_values(by='比例')\n",
    "fig = px.bar(df_mcq_2, x=\"比例\",orientation='h')\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>开屏广告态度</th>\n",
       "      <th>个数</th>\n",
       "      <th>百分比</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>很讨厌</td>\n",
       "      <td>268</td>\n",
       "      <td>70.90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>不介意</td>\n",
       "      <td>104</td>\n",
       "      <td>27.51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>很喜欢</td>\n",
       "      <td>6</td>\n",
       "      <td>1.59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>总和</td>\n",
       "      <td>378</td>\n",
       "      <td>100.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  开屏广告态度   个数     百分比\n",
       "0    很讨厌  268   70.90\n",
       "1    不介意  104   27.51\n",
       "2    很喜欢    6    1.59\n",
       "3     总和  378  100.00"
      ]
     },
     "execution_count": 132,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mytools.gen_percent_table(df,'开屏广告态度')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 双变量统计分析\n",
    "result = pd.crosstab(\n",
    "        df['开屏广告态度'],\n",
    "        df['性别'],\n",
    "        normalize='columns',\n",
    "        margins=True,\n",
    "        margins_name='合计',\n",
    "    )*100\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>性别</th>\n",
       "      <th>女</th>\n",
       "      <th>男</th>\n",
       "      <th>合计</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告态度</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>不介意</th>\n",
       "      <td>27.80</td>\n",
       "      <td>26.89</td>\n",
       "      <td>27.51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>很喜欢</th>\n",
       "      <td>0.77</td>\n",
       "      <td>3.36</td>\n",
       "      <td>1.59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>很讨厌</th>\n",
       "      <td>71.43</td>\n",
       "      <td>69.75</td>\n",
       "      <td>70.90</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "性别          女      男     合计\n",
       "开屏广告态度                     \n",
       "不介意     27.80  26.89  27.51\n",
       "很喜欢      0.77   3.36   1.59\n",
       "很讨厌     71.43  69.75  70.90"
      ]
     },
     "execution_count": 134,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result.round(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 135,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'tau_y值为：0.001，该值属于极弱相关或不相关。'"
      ]
     },
     "execution_count": 135,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tau_y = mytools.goodmanKruska_tau_y(df, '性别', '开屏广告态度')\n",
    "F'tau_y值为：{tau_y:.3f}，该值属于{mytools.draw_on_corr(tau_y)}。'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 136,
   "metadata": {},
   "outputs": [],
   "source": [
    "from scipy import stats\n",
    "x=df['性别']\n",
    "y=df['开屏广告态度']\n",
    "chi2, p, dof, ex = stats.chi2_contingency(pd.crosstab(x, y))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3.500504691900653, 0.1737300978319079)"
      ]
     },
     "execution_count": 137,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chi2,p"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.8.10 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "9650cb4e16cdd4a8e8e2d128bf38d875813998db22a3c986335f89e0cb4d7bb2"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
